var fs = require("fs");
var events = require('events').EventEmitter;
var event= new events();

fs.readFile('event_read.txt','utf8',function (err,data) {
	event.emit('write',data);

})

event.on('write',function(data){
	console.log(data);
	fs.writeFile('event_write.txt', data,  function(err) {
		   if (err) {
		       return console.error(err);
		   } 
		   console.log("事件触发 数据写入成功！");
		   console.log("--------我是分割线-------------")
		   
	});
})